# -*- coding:utf-8 -*-
#! /bin/python

def cmp(a,b):
    return (a > b) - (a < b)
item_prefix="     "
def MarkDuplicatedButFirst(_listbox):
    group_num=0
    for i in range(0,_listbox.size()):
        _line_str = _listbox.get(i)
        #print i,_line_str
        if cmp(item_prefix,_line_str[0:min(len(item_prefix),len(_line_str))]) != 0:
            group_num = 0
        elif group_num == 0:
            group_num = group_num + 1
        else:
            _listbox.selection_set(i)
            #print i
        #print group_num
    #print _listbox.curselection()